<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.org/ui">

	<ui:composition template="/templates/masterLayout.xhtml">
		<ui:define name="content">
			<h:form id="donHangFilterId">
				<p:panel styleClass="simple-panel">
					<p:outputLabel for="maDonHangFilterId" value="Mã đơn hàng: " style="font-weight:bold" />
					<p:inputText id="maDonHangFilterId" value="#{donHangView.dataModel.maDonHangFilter}" style="margin-right: 10px;" />

					<p:outputLabel for="fromDateFilterId" value="Từ ngày: " style="font-weight:bold" />
					<p:calendar id="fromDateFilterId" value="#{donHangView.dataModel.fromDateFilter}" style="margin-right: 10px;"
						showOn="button">
						<f:ajax event="dateSelect" onevent="focusOnInput(this)" />
					</p:calendar>

					<p:outputLabel for="toDateFilterId" value="Đến ngày: " style="font-weight:bold" />
					<p:calendar id="toDateFilterId" value="#{donHangView.dataModel.toDateFilter}" style="margin-right: 10px;"
						showOn="button">
						<f:ajax event="dateSelect" onevent="focusOnInput(this)" />
					</p:calendar>

					<p:commandButton icon="ui-icon-search" id="searchBtnId" process="@form"
						update=":donHangListFormId:donHangDataTableId" />
					<p:commandButton icon="ui-icon-cancel" action="#{donHangView.dataModel.clearFilters}"
						update="@form, :donHangListFormId:donHangDataTableId" />
					<p:defaultCommand target="searchBtnId" />
				</p:panel>
			</h:form>

			<h:form id="donHangListFormId">
				<p:dataTable id="donHangDataTableId" value="#{donHangView.dataModel}" selection="#{donHangView.selectedEntities}"
					paginator="true" var="entity" rows="10"
					paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"
					lazy="true" paginatorPosition="bottom">
					<p:ajax event="rowDblselect" listener="#{donHangView.editAction}" partialSubmit="true"
						oncomplete="donHangDialog.show()" update=":donHangDetailFormId" />
					<f:facet name="header">
						<p:commandButton icon="ui-icon-plus" value="Tạo mới" action="#{donHangView.newAction}"
							actionListener="#{donHangView.reset}" update=":donHangDetailFormId" oncomplete="donHangDialog.show()"
							style="float:left" />

						<div style="clear: both;" />
					</f:facet>

					<p:column selectionMode="multiple" style="width:1%" />

					<p:column headerText="Mã số">
						<h:outputText value="#{entity.code}" />
					</p:column>

					<p:column headerText="Tg đặt hàng" sortBy="#{entity.thoiGianDatHang}">
						<h:outputText value="#{entity.thoiGianDatHang}" />
					</p:column>
					<p:column headerText="Tg thanh toán" sortBy="#{entity.thoiGianThanhToan}">
						<h:outputText value="#{entity.thoiGianThanhToan}" />
					</p:column>
					<p:column headerText="Trạng thái">
						<h:outputText value="#{entity.trangThai}" />
					</p:column>
					<f:facet name="footer">
					</f:facet>
				</p:dataTable>
			</h:form>

			<ui:include src="donHangDetails.xhtml" />
		</ui:define>
	</ui:composition>


</ui:composition>